SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.[DnnProduct_GetSearchResults]

	@PortalID int,
	@TabId int,
	@ModuleId int

AS
	SELECT DISTINCT
		*
	FROM   dbo.DnnProduct_vw_SearchItems
	WHERE (PortalId = @PortalID or @PortalID is null)
		AND   (TabId = @TabId or @TabId is null)
		AND   (ModuleId = @ModuleId or @ModuleId is null)
	ORDER BY PubDate DESC

GO
